package jd;

import java.util.*;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2024/11/9-上午10:20
 * Since  :   1.0
 * Version:   1.0
 */
public class mingganci {

    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int n=scanner.nextInt();
//        String s=scanner.next();
//        ArrayList<String> strings = new ArrayList<>();
//        while (n>0) {
//            strings.add(scanner.next());
//            n--;
//        }
//        String result = findResult(s, strings);
//        System.out.println(result);
        String s="iakioikiio";

        ArrayList<String> strings = new ArrayList<>();
        strings.add("kii");
        strings.add("io");
        strings.add("qwq");
        String result = findResult(s, strings);
        System.out.println(result);
    }

    public static String findResult(String s, List<String> target){
        HashMap<Integer, Integer> map = new HashMap<>();


        for (String str:target){
            String temp=s;
            int preLength=0;
            while (temp.contains(str)){
                map.put(temp.indexOf(str)+preLength,str.length());
                int jiequ=temp.indexOf(str)+str.length();
                temp=temp.substring(jiequ);
                preLength+=jiequ;
            }


        }

        Set<Integer> integers = map.keySet();
        for (int index:integers){

            int length = map.get(index);
            for (int i=0;i<length;i++){
                if (s.charAt(index+i)!='*'){
                    s=s.substring(0,index+i)+"*"+s.substring(index+i+1,s.length());
                }
            }


        }
        return  s;


    }

}
